package zdream.control.region;

import java.util.Objects;

/**
 * <p>在区域中标定的点, 属于区域
 * </p>
 *
 * @author Zdream
 * @since 0.0.1
 * @date
 *   2019-05-18 (created)
 *   2019-05-18 (last modified)
 */
public class InterestPoint {
	public final String name;

	/**
	 * 在该区域中的位置
	 */
	public final float xInRegion, yInRegion;

	public Room room;
	public float xInRoom, yInRoom;

	public InterestPoint(String name, float xInRegion, float yInRegion) {
		this.name = name;
		this.xInRegion = xInRegion;
		this.yInRegion = yInRegion;
	}

	public void setRoom(Room room) {
		this.room = Objects.requireNonNull(room);
		this.xInRoom = room.transformFromRegionX(xInRegion);
		this.yInRoom = room.transformFromRegionY(yInRegion);
	}

	public boolean isForFoeSpawn() {
		return false;
	}

	public FoeSpawnPoint asFoeSpawn() {
		throw new RuntimeException(
				this.getClass().getSimpleName() + " is not a " + FoeSpawnPoint.class.getSimpleName());
	}

	public boolean isForSave() {
		return false;
	}

	public SavePoint asSave() {
		throw new RuntimeException(
				this.getClass().getSimpleName() + " is not a " + SavePoint.class.getSimpleName());
	}
}
